﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yq.ICache
{

    /// <summary>
    /// 缓存类别
    /// </summary>
    public enum CaCheType
    {
        WebCache=1,
        Redis=2,
        No=0
    }


    /// <summary>
    /// 表(类对象)与读写地址的配对关系
    /// </summary>
    public class ConfigHost
    {
        public string Key
        {
            get
            {
                return "Type:" + Type.GetHashCode() + ",WriteHost:" + WriteHost + ",ReadHosts:" + String.Concat(ReadHosts);
            }
        }

        public CaCheType Type { get; set; }

        public bool isDefault { get; set; }

        /// <summary>
        /// 对象完整类名
        /// </summary>
        public string FullName { get; set; }

        /// <summary>
        /// 指定对象由何写站点提供操作
        /// </summary>
        public string WriteHost { get; set; }

        /// <summary>
        /// 指定对象由何读站点提供操作
        /// </summary>
        public string[] ReadHosts { get; set; }

        /// <summary>
        /// 写连接数量
        /// </summary>
        private int _WriteCount = 5;
        /// <summary>
        /// 写连接数量
        /// </summary>
        public int WriteCount
        {
            get { return _WriteCount; }
            set { _WriteCount = value; }
        }

        /// <summary>
        /// 读连接数量
        /// </summary>
        private int _ReadCount = 5;
        /// <summary>
        /// 读连接数量
        /// </summary>
        public int ReadCount
        {
            get { return _ReadCount; }
            set { _ReadCount = value; }
        }

    
    }
}
